package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.AcademicPosition;
import com.management.department.teacherinfosystem.Entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface AcademicPositionRepository extends JpaRepository<AcademicPosition, Long>, JpaSpecificationExecutor<AcademicPosition> {
    List<AcademicPosition> findByUser(User user);
    List<AcademicPosition> findByStatus(String status);

    @Query("select ap from AcademicPosition ap join fetch ap.user")
    List<AcademicPosition> findAllWithUser();
} 